<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href='https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css' rel='stylesheet'>
    <script src="/static/js/form-check.js" type="text/javascript"></script>
    <script src="/static/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" >
        $(function () {
            $("#code").blur(function () {
              var code = $(this).val();
              if(code==null||code==''){
                  $(this).next().html("请输入编码");
              }else{
                 $.ajax({
                     url:"/findByCode",
                     data:"code="+code,
                     type:"post",
                     dateType:"json",
                     success:function (rs) {
                         if (rs!=null&&rs!=''){
                             $("#code").next().html("该编码已经存在");
                         }else{
                             $("#code").next().html("");
                         }
                     }
                 })
              }
            })
        })
    </script>
</head>
<body>
<h3 contenteditable="true">商品添加</h3>
<form action="/shangpin_add" method="post">
    <table>
        <tr>
            <th>
                <div class="form-group">
                    商品编码:<input type="text" name="commCode" id="code" required><span style="color: #cc0000"></span>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品条形码:<input type="text" name="commBarCode" required>
                </div>
            </th>
        </tr>
        <tr>
            <div class="form-group">
                <th>
                    商品名称:<input type="text" name="commName" required>
                </th>
            </div>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    品牌:
                    <select name="brandId">
                    <#list brandList as brand>
                        <option value="${brand.bid}">${brand.bname}</option>
                    </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    品类:
                    <select name="commTypeId">
                    <#list commTypes as type>
                        <option value="${type.typeId}">${type.typeName}</option>
                    </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    进货价:<input type="number" name="jhPrice" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    成本价:<input type="number" name="cbPrice" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品容量:<input type="number" name="capacity" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    仓库编号:
                    <select name="kunncunId">
                        <#list goodsList as go>
                            <option>
                                ${go.gid}
                            </option>
                        </#list>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    30天销量:<input type="number" name="salesVolume" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品规格:<input type="text" name="size" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    重量:<input type="number" name="weight" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品体积:<input type="number" name="volume" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    地址:<input type="text" name="address" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    包装单位:<input type="text" name="packge" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品描述 :<input type="text" name="des" required>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    商品状态:
                    <select name="status">
                        <option value="1">已上架</option>
                        <option value="0">未上架</option>
                    </select>
                </div>
            </th>
        </tr>
        <tr>
            <th>
                <div class="form-group">
                    是否促销:
                    <select name="cstatus">
                        <option value="1">促销</option>
                        <option value="0">非促销</option>
                    </select>
                </div>
            </th>
        </tr>
         <#list channelList as ch>
        <tr>
            <th>
                <div class="form-group">
                    渠道商家:${ch.cname}:<input type="checkbox" name="ch" value="${ch.channelId}" >
                <#--渠道的售价:<input type="number" name="sj">-->
                <#--渠道的成交价:<input type="number" name="cjj">-->
                </div>
            </th>
        </tr>
         </#list>
        <tr>
            <th>
                <div class="form-group">
                    <input type="submit" value="添加">
                </div>
            </th>
        </tr>
</form>
</table>
</body>
</html>